package com.qf.mapper;

import com.qf.entity.StatOrder;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;

/**
 * <p>title: com.qf.mapper</p>
 * <p>Company: wendao</p>
 * author zhuximing
 * date 2021/9/24
 * description:
 */
public interface OrderStatMapper {

    @Select("select date_format( create_time,'%Y-%m-%d') as sta_dat, sum(pay_amount) as sta_amount ,count(*) as sta_cunt from oms_order\n" +
        "\n" +
        "where date_format( create_time,'%Y-%m-%d') = date_sub(curdate(), interval 1 day)")
    public StatOrder statOrderInfoByPerDay();




    @Insert("insert into stat_order (sta_dat,sta_amount,sta_cunt)values(#{staDat},#{staAmount},#{staCunt})")
    public  int saveStatRes(StatOrder statOrder);


    public List<StatOrder> findStatOrderByDate(@Param("start") String start, @Param("end") String end);


}